<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tag/c.tld"%>
<div id="dbConfigTableEdit">
<section class="panel">
	<div class="panel-body">
		<form action="${webRoot}/pageConfig/entity/save" id="formPageEntityInfo" class="form-horizontal">
			<input type="hidden" name="projectCode" value="${project.projectCode}"/>
			<input type="hidden" name="id" value="${pageEntity.entityClassName }"/>
			<div class="form-group">
		    	<label class="col-sm-2 control-label">实体类名称</label>
		    	<div class="col-md-4">
		    	<input type="text" class="form-control" name="entityClassName" value="${pageEntity.entityClassName }" readOnly/>
		    	</div>
		    	<label class="col-sm-2 control-label">实体中文名</label>
		    	<div class="col-md-4">
		    	<input type="text" class="form-control" name="entityChinaName" value="${pageEntity.entityChinaName }"/>
		    	</div>
		  	</div>
		  	<div class="form-group">
		  		<label class="col-sm-2 control-label">菜单标题</label>
		    	<div class="col-md-4">
		    	<input type="text" class="form-control" name="menuName" value="${pageEntity.menuName }"/>
		    	</div>
		    	<label class="col-sm-2 control-label">编辑显示模式</label>
		    	<div class="col-md-4">
		    	<select name="toEditModal" class="form-control">
		    		<option value="eject" <c:if test="${pageEntity.toEditModal=='eject'}">selected</c:if>>弹出框</option>
		    		<option value="skip" <c:if test="${pageEntity.toEditModal=='skip'}">selected</c:if>>跳转页面</option>
		    	</select>
		    	</div>
		  	</div>
		  	<div class="form-group">
		  		<div class="col-md-10"></div>
		  		<div class="col-md-2">
		    		<button type="button" class="btn btn-default" id="btnSavePageEntity">保存</button>
		    	</div>
		  	</div>
		</form>
	</div>
</section>
<section class="panel">
	<div class="panel-body">
	<table class="table table-bordered table-hover" id="tablePageEntityField"></table>
	</div>
</section>
<script type="text/javascript">
$(function(){
	$('#tablePageEntityField').jfTable({
		pagingEl:null,
		ajax:{
			url:'${webRoot}/pageConfig/entity/field/data',
			param:function(param){
				return {
					code:'${project.projectCode}',
					entityCode:$('#formPageEntityInfo input[name="id"]').val()
				};
			}
		},
		editAjax:{
			url:'${webRoot}/pageConfig/entity/field/cell/update',
			param:function(record,code,value){
				return {
					code:'${project.projectCode}',
					entityCode:$('#formPageEntityInfo input[name="id"]').val(),
					fieldCode:record.code,
					name:code,
					value:value
				};
			}
		},
		cols:[{
			code:'code',
			title:'字段代码'
		},{
			code:'name',
			inputType:'text',
			title:'字段名称'
		},{
			code:'inputType',
			inputType:'text',
			title:'编辑控件的类型'
		},{
			code:'isDisplayTable',
			inputType:'checkbox',
			title:'是否显示在表格上'
			
		},{
			code:'isDisplayForm',
			inputType:'checkbox',
			title:'是否显示在表单上'
		}]
	});
	
	$('#btnSavePageEntity').click(function(){
		$('#formPageEntityInfo').jfForm('submit',function(result){
			if(result.error==1){
				$('#tablePageEntityField').jfTree('refreshLoad','news');
				$('#formPageEntityInfo input[name="id"]').val(result.data.code);
				jf.info("保存成功");
			}else{jf.error(result.msg);}
		});
	});
})
</script>
</div>